<?php


namespace app\api\controller;


use logicmodel\BoxLogic;
use think\Controller;
use think\Request;

class Box extends Controller
{
    private $boxLogic;
    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $this->boxLogic = new BoxLogic();
    }

    /**
     * 盲盒列表
     * @param $search
     * @param int $time_order
     * @param int $price_order
     * @param int $page
     * @param int $pagesize
     * @return \think\response\Json
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function boxList($search,$time_order=1,$price_order=1,$page=1,$pagesize=10){
        return json($this->boxLogic->boxList($search,$time_order,$price_order,$page,$pagesize));
    }

    /**
     * 盲盒详情
     * @param $id
     * @return \think\response\Json
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function boxDetail($id){
        return json($this->boxLogic->boxDetail($id));
    }
        /**
     * 盲盒开奖记录
     * @param $box_id
     * @param $page
     * @param $pagesize
     * @return \think\response\Json
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function boxRecord($box_id,$page=1,$pagesize=10){
        return json($this->boxLogic->boxRecord($box_id,$page,$pagesize));
    }


}